/** Colors for DirectX
**
** @version: $Id: Colors.h 151 2010-10-14 10:39:16Z Tim Brengle $
*/
#pragma once
#include "d3dx9.h"


const D3DXCOLOR NONE		= D3DCOLOR_COLORVALUE(0.0f, 0.0f, 0.0f, 0.0f);	// alpha == 0 means invisible
const D3DXCOLOR CLEAR		= NONE;

const D3DXCOLOR BLACK		= D3DCOLOR_COLORVALUE(0.0f, 0.0f, 0.0f, 1.0f);
const D3DXCOLOR WHITE		= D3DCOLOR_COLORVALUE(1.0f, 1.0f, 1.0f, 1.0f);

const D3DXCOLOR RED			= D3DCOLOR_COLORVALUE(1.0f, 0.0f, 0.0f, 1.0f);
const D3DXCOLOR GREEN		= D3DCOLOR_COLORVALUE(0.0f, 1.0f, 0.0f, 1.0f);
const D3DXCOLOR BLUE		= D3DCOLOR_COLORVALUE(0.0f, 0.0f, 1.0f, 1.0f);

const D3DXCOLOR CYAN		= D3DCOLOR_COLORVALUE(0.0f, 1.0f, 1.0f, 1.0f);
const D3DXCOLOR MAGENTA		= D3DCOLOR_COLORVALUE(1.0f, 0.0f, 1.0f, 1.0f);
const D3DXCOLOR YELLOW		= D3DCOLOR_COLORVALUE(1.0f, 1.0f, 0.0f, 1.0f);

/* Other favorites: */
const D3DXCOLOR ORANGE		= D3DCOLOR_COLORVALUE(1.0f,   0.5f, 0.0f, 1.0f);
const D3DXCOLOR PURPLE		= D3DCOLOR_COLORVALUE(0.749f, 0.0f, 1.0f, 1.0f);

const D3DXCOLOR LIGHT_BLUE	= D3DCOLOR_COLORVALUE(0.35f, 0.53f, 0.7, 1.0f);

const D3DXCOLOR GOLD		= D3DCOLOR_COLORVALUE(1.0f,   0.954f, 0.392f, 1.0f);
const D3DXCOLOR GOLD2		= D3DCOLOR_COLORVALUE(1.0f,   0.8f,   0.2f,   1.0f);
const D3DXCOLOR BRONZE		= D3DCOLOR_COLORVALUE(1.0f,   0.588f, 0.04f,  1.0f);
const D3DXCOLOR COPPER		= D3DCOLOR_COLORVALUE(0.722f, 0.451f, 0.2f,   1.0f);
const D3DXCOLOR SILVER		= D3DCOLOR_COLORVALUE(0.75f,  0.75f,  0.75f,  1.0f);
const D3DXCOLOR COBALT_BLUE	= D3DCOLOR_COLORVALUE(0.0f,   0.311f, 0.75f,  1.0f);

const D3DXCOLOR RUBY		= D3DCOLOR_COLORVALUE(0.88f,  0.07f,  0.25f,  0.7f);
const D3DXCOLOR EMERALD		= D3DCOLOR_COLORVALUE(0.31f,  0.78f,  0.47f,  0.7f);
const D3DXCOLOR SAPPHIRE	= D3DCOLOR_COLORVALUE(1.0f,   0.954f, 0.392f, 0.7f);

/* DeVry official colors */
const D3DXCOLOR DEVRY_BLUE1	= D3DCOLOR_COLORVALUE(0.063f, 0.231f, 0.408f, 1.0f);
const D3DXCOLOR DEVRY_BLUE2	= D3DCOLOR_COLORVALUE(0.035f, 0.212f, 0.471f, 1.0f);
const D3DXCOLOR DEVRY_GOLD1	= D3DCOLOR_COLORVALUE(0.820f, 0.596f, 0.0f,   1.0f);
const D3DXCOLOR DEVRY_GOLD2	= D3DCOLOR_COLORVALUE(0.820f, 0.592f, 0.0f,   1.0f);
const D3DXCOLOR DEVRY_RED1	= D3DCOLOR_COLORVALUE(0.929f, 0.090f, 0.122f, 1.0f);
const D3DXCOLOR DEVRY_RED2	= D3DCOLOR_COLORVALUE(0.949f, 0.0f,   0.090f, 1.0f);
const D3DXCOLOR DEVRY_WHITE	= D3DCOLOR_COLORVALUE(1.0f,   1.0f,   1.0f,   1.0f);


/*****************************************************\
* HSICOLOR                                            *
*    like D3DXCOLOR but with HSI names instead of RGB *
\*****************************************************/
struct HSICOLOR
{
	float h, s, i, a;

	inline HSICOLOR(const float h, const float s, const float i, const float a)
	  : h(h), s(s), i(i), a(a)
	{
	}
};


/*****************************************************\
* RGB to HSI color space                              *
*  for manipulation of color, intensity, saturation   *
\*****************************************************/
extern HSICOLOR RGB2HSI(const D3DXCOLOR RGB);


/*****************************************************\
* HSI to RGB color space                              *
\*****************************************************/
extern D3DXCOLOR HSI2RGB(const HSICOLOR HSI);


/*****************************************************\
* Cycle color: use HSI to tweak color only            *
\*****************************************************/
extern D3DXCOLOR CycleColor(const D3DXCOLOR RGB, const float fIncrement);